package com.bdqn.zhang.service.impl;

import com.bdqn.zhang.mapper.UserMapper;
import com.bdqn.zhang.pojo.User;
import com.bdqn.zhang.service.UserService;
import com.bdqn.zhang.util.LayData;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <Description> <br>
 *
 * @author tao<br>
 * @version 1.0<br>
 * @taskId: <br>
 * @createDate 2019/09/06 16:19 <br>
 * @see com.bdqn.service.impl <br>
 */
@Service("userService")
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;

    @Override
    public User login(String username,String password) {
        return userMapper.login(username,password);
    }

    @Override
    public Long addSave(User user) {
        return userMapper.addSave(user);
    }

    @Override
    public LayData getAll(Long currentPage,Long pageSize) {
        return LayData.data(userMapper.count(),userMapper.getAll((currentPage-1)*pageSize,pageSize));

    }


}
